//var node_env = require('../node_env')
var webpack = require('webpack')
var merge = require('webpack-merge')
var utils = require('./utils')
//var styleconfig = require('./styleconfig')
var baseWebpackConfig = require('./webpack.base.config')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var extractTextPlugin = require('extract-text-webpack-plugin')
//var querystring = require('querystring')

// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
  baseWebpackConfig.entry[name] = ['./config/dev-client'].concat(baseWebpackConfig.entry[name])
})

module.exports = merge(baseWebpackConfig, {
  // module: {
  //   loaders: styleconfig.styleLoaders({ sourceMap: false })
  // },
  // eval-source-map is faster for development
  //devtool: '#eval-source-map',
  plugins: [
    // new webpack.DefinePlugin({
    //   'process.env': node_env.dev.env
    // }),
    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin(),
    new extractTextPlugin('css/[id].[name].css',{allChunks:true})// css抽取
  ]
})

//   module.exports.module.loaders.forEach(function(i){
// console.log('--------------1-----------'+JSON.stringify(i)+'----------2---------------');
//   });
 module.exports.plugins=module.exports.plugins.concat(utils.createHtml());
